Passed
Pull Request — master (#70)
by Mathieu
01:44
created

DateUtilsAdapter.getCurrentDate   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 1
1
import {Injectable} from '@nestjs/common';
2
import {
3
  format as fnsFormat,
4
  isWeekend as fnsIsWeekend,
5
  getDaysInMonth as fnsGetDaysInMonth
6
} from 'date-fns';
7
import {IDateUtils} from 'src/Application/IDateUtils';
8
9
@Injectable()
10
export class DateUtilsAdapter implements IDateUtils {
11
  public format(date: Date, format: string): string {
12
    return fnsFormat(date, format);
13
  }
14
15
  public getDaysInMonth(date: Date): number {
16
    return fnsGetDaysInMonth(date);
17
  }
18
19
  public isWeekend(date: Date): boolean {
20
    return fnsIsWeekend(date);
21
  }
22
23
  public getCurrentDate(): Date {
24
    return new Date();
25
  }
26
}
27